package first.niuke.midding;

/**
 * @ClassName NC2
 * @description:
 * @author: 荣燊
 * @create: 2021-06-01 19:19
 **/
public class NC2 {
    /**
     * 重排链表
     * @param args
     */
    public static void main(String[] args) {

    }

    public void reorderList(ListNode head) {
        if (head != null || head.next != null) {
            ListNode h = new ListNode(head.val);
        }
        dfs(head.next);

    }

    void dfs (ListNode head) {
        if (head == null || head.next == null) {
            return;
        }
        dfs(head.next);
        head.next.next = head;
    }

    class ListNode {
        int val;
        ListNode next;
        ListNode(int x) {
            val = x;
            next = null;
        }
     }
}
